package com.example.oms.service.impl;

import com.example.oms.common.enums.SmsStatus;
import com.example.oms.dto.entity.OmsSmsTaskEntity;
import com.example.oms.dto.ro.SmsCallBackRO;
import com.example.oms.mapper.OmsSmsTaskMapper;
import com.example.oms.service.SmsStepService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class SmsStepServiceImpl implements SmsStepService {

    @Resource
    private OmsSmsTaskMapper omsSmsTaskMapper;

    @Transactional
    @Override
    public void handleSmsStatus(SmsCallBackRO ro) {
        OmsSmsTaskEntity omsSmsTaskEntity = omsSmsTaskMapper.selectById(ro.getSendId());
        omsSmsTaskEntity.setStatus(SmsStatus.SUCCESS.getValue());
        omsSmsTaskMapper.updateById(omsSmsTaskEntity);
    }
}
